<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%
    // 查询科室模板
    List<String> hospitals = QBuilder.db("basedb").select("descr").from("Hospital").where(new Where("hospital=", hospital).and("status=", STATUS_ENABLE)).query().getResultObj();
    if (hospitals.size() == 0) {
        msg = new Message(30041, "暂无随访模板");
        msg.put("data", new ArrayList());
        Tools.encryptPrint(out, msg);
        return;
    }
    List<Map> surveys = QBuilder.db("basedb").select("new map(id as survey_id, title as title, detail as detail)").from("Survey").where(new Where("hospital=0").and("status = ", STATUS_ENABLE).and("enable = ", STATUS_ENABLE).and("category=2").and("belong like '%"+hospitals.get(0)+"%'")).query().getResultObj();
    if (surveys.size() == 0) {
        msg = new Message(30041, "暂无随访模板");
    }
    msg.put("data", surveys);
    Tools.encryptPrint(out, msg);
%>
